package com.ls.common;

/**
 * <p></p>
 * Created by zhezhiyong@163.com on 2017/2/20.
 */
public enum ActionEnum {
    SAVE("保存", "save", "icon-add"), DELETE("删除", "delete", "icon-remove"), UPDATE("更新", "update", "icon-edit"), VIEW("视图", "view", "icon-search");
    // 成员变量
    private String name;
    private String permission;
    private String iconCls;

    // 构造方法
    private ActionEnum(String name, String permission, String iconCls) {
        this.name = name;
        this.permission = permission;
        this.iconCls = iconCls;
    }

    // 普通方法
    public static ActionEnum getName(String index) {
        for (ActionEnum c : ActionEnum.values()) {
            if (index.equals(c.getPermission())) {
                return c;
            }
        }
        return null;
    }

    // get set 方法
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIconCls() {
        return iconCls;
    }

    public void setIconCls(String iconCls) {
        this.iconCls = iconCls;
    }

    public String getPermission() {
        return permission;
    }

    public void setPermission(String permission) {
        this.permission = permission;
    }
}
